home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / game / role / ldmud-3.2-bin.lha / mud / doc / LPC / if < prev    next >
Text File  |  2001-04-06  |  1KB  |  40 lines

  1. NAME
  2.         if
  3.  
  4. SYNTAX
  5.         if (expr1) statement1;
  6.         else if (expr2) statement2;
  7.         ...
  8.         else if (exprN) statementN;
  9.         else statementX;
  10.  
  11. DESCRIPTION
  12.         The if() statement implements the conditional execution of statements.
  13.         The expressions 'expr1' .. 'exprN' are evaluate in the order they
  14.         appear until one of the expressions returns non-0 ('true'). At that
  15.         point, the statement associated with the expression is executed, and
  16.         the program continues after the if() statement. If none of the
  17.         expressions evaluate to 'true', the statementX in the 'else'-branch
  18.         is executed.
  19.  
  20.         Both the 'else if' branches and the 'else' branch are optional, and
  21.         there can be any number of 'else if' branches - but there must be one
  22.         'if' branch, and the branches must be in the order given above.
  23.  
  24.         Any 'else' or 'else if' always relates to the immediately preceeding
  25.         'if' resp. 'else if' conditional. This means that
  26.  
  27.           if (a)
  28.           if (b) do_b;
  29.           else do_c;
  30.  
  31.         is interpreted as
  32.         
  33.           if (a) {
  34.             if (b) do_b;
  35.             else   do_c;
  36.           }
  37.  
  38. SEE ALSO
  39.         for(LPC), foreach(LPC), do-while(LPC), while(LPC), switch(LPC)
  40.